//
//  SearchRecordCell.swift
//  ImGuider X
//
//  Created by 王鹏宇 on 10/9/18.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit

class SearchRecordCell: UICollectionViewCell {

    @IBOutlet weak var scenicimageView: UIImageView!
    @IBOutlet weak var officalLabel: UILabel!
    @IBOutlet weak var scenicNameLabel: UILabel!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.scenicimageView.layer.borderColor = UIColor.hexStringToColor(hexString: "#0ECEA6").cgColor
        
        self.officalLabel.textColor = KThemeColor
    }

    var isSelect : Bool = false {
        
        didSet{
            
            if isSelect {
                self.scenicimageView.layer.borderWidth = 3
            }else{
                self.scenicimageView.layer.borderWidth = 0
            }
        }
    }
    
    func configData(record : Record){
        
        if let image = UIImage(named: "placeholder_squ") {
            self.scenicimageView.setImage(string: record.pictureArray?.first, placeholder: image)
        }
        self.scenicNameLabel.text = record.spotname
        
        let str = NSMutableAttributedString(string:LocalizedString("record_id"))
        str.yy_color = UIColor.white
        
        let str1 = NSMutableAttributedString(string:record.nodenumber ?? "")
        str1.yy_color = KThemeColor
        
        str.append(str1)
    
        self.officalLabel.attributedText = str
    }
}
